import Vue from "vue";
import Router from "vue-router";
import Home from "./views/index.vue";
Vue.use(Router);
// {
//   path: "/about",
//   name: "about",
//   // route level code-splitting
//   // this generates a separate chunk (about.[hash].js) for this route
//   // which is lazy-loaded when the route is visited.
//   component: () = //     import("./views/About.vue")
// },

export default new Router({
  mode: "history",
  base: process.env.BASE_URL,
  routes: [
    {
      path: "/",
      name: "index",
      component: Home,
      children: [
        {
          path: "/",
          // redirect: "/type/home"
          component: () => import("./views/blog_list.vue")

        },
        {
          path: "/type/:type",
          component: () => import("./views/blog_list.vue")
        },
        {
          path: "/:id",
          component: () => import("./views/blog_details.vue")
        }
      ]
    },
    {
      path: "/admin",
      component: () => import("./views/admin/index.vue"),
      children: [
        {
          path: "/admin",
          redirect: "/admin/index"
        },
        {
          path: "/admin/index",
          component: () => import("./views/admin/hello.vue")
        },
        {
          path: "/admin/category",
          component: () => import("./views/admin/category.vue")
        },
        {
          path: "/admin/user_list",
          component: () => import("./views/admin/user_list.vue")
        },
        {
          path: "/admin/categoryadd",
          component: () => import("./views/admin/categoryadd.vue")
        },
        {
          path: "/admin/blog_list",
          component: () => import("./views/admin/blog_list.vue")
        },
        {
          path: "/admin/blog_add",
          component: () => import("./views/admin/blog_add.vue")
        }
      ]
    }
  ]
});
